package com.cbw.socket.upd;


import org.junit.Test;

import java.io.IOException;
import java.net.*;

public class udp {
    @Test
    public void test() throws IOException {

        String str = "社会我浩哥！！！！！！";

            DatagramSocket datagramSocket = new DatagramSocket(8080);

//        byte[] bytes = str.getBytes("gb2312");
//        DatagramPacket datagramPacket = new DatagramPacket(bytes,bytes.length, InetAddress.getLocalHost(),8899);
        while (true) {
        DatagramPacket datagramPacket = new DatagramPacket(str.getBytes("gb2312"), str.getBytes("gb2312").length, InetAddress.getByName("192.168.0.189"), 10086);

            datagramSocket.send(datagramPacket);
        }

    }
}
